package com.mysqldemo.exception;

import com.mysqldemo.enums.ResponseCodeEnum;

/**
 * @Author xiaoyi
 * @Version 1.0
 * @ClassName BusinessException
 * @Time 21:26
 */
public class BusinessException extends Exception{
    private ResponseCodeEnum CodeEnum;
    private Integer code;
    private String message;

   public BusinessException(String message,Throwable e){
       super(message,e);
       this.message = message;
   }

   public BusinessException(String message){
         super(message);
         this.message = message;
   }
    public BusinessException(Throwable e){
        super(e);
    }
    public BusinessException(ResponseCodeEnum codeEnum){
        super(codeEnum.getMessage());
        this.CodeEnum = codeEnum;
        this.code = codeEnum.getCode();
        this.message = codeEnum.getMessage();
    }
    public BusinessException(Integer code,String Message){
        super(Message);
        this.code = code;
        this.message = Message;
    }

    public ResponseCodeEnum getCodeEnum() {
        return CodeEnum;
    }

    public void setCodeEnum(ResponseCodeEnum codeEnum) {
        CodeEnum = codeEnum;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public Throwable fillInStackTrace(){
       return this;
    }
}
